<%-- 
    Document   : savedccr
    Created on : June 7, 2011, 2:12:01 AM
    Author     : MacBook
--%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<div id="ccrcontent">
    <s:set name="stat" value="stat"/>

    <s:if test="%{#stat!='ok'}">
        <dl class="ui-state-error ui-corner-all">
            <dt><span class="ui-icon ui-icon-alert"></span><s:property value="#stat"/></dt>
        </dl>
    </s:if>
    <s:elseif test="%{#stat=='ok'}">
        <dl class="ui-state-highlight ui-corner-all" style="clear:both">
            <dt><span class="ui-icon ui-icon-info"></span>Cash Custodian Report saved!</dt>
        </dl>
    </s:elseif>
    <s:if test="%{#privilegeEdit.allowable == false}">
        <dl class="ui-state-highlight ui-corner-all" style="clear:both">
            <dt><span class="ui-icon ui-icon-info"></span>You are not allowed to edit in this module.</dt>
        </dl>
        <script type="text/javascript">
            $(document).ready(function(){
                $('#savereport').attr("disabled","disabled");
            });
        </script>
    </s:if>
    <s:form action="post-ccr" theme="simple" cssStyle="overflow: auto; padding: 0;font-size: 12px;width:990px;" id="ccreport">
        <table id="first">
            <tr><s:textfield name="ccrid" cssStyle="display:none" value="%{#request.cashcustodian.ccrid}"/>
                <td><s:label>Branch</s:label></td>
                <td><s:textfield id="branch" name="branch" value="%{#request.cashcustodian.branches.branchname}"/></td>
                <s:textfield name="branchid" cssStyle="display:none"  value="%{#request.cashcustodian.branches.branchid}"/>
            </tr>
            <tr>
                <td><s:label>Employee Code</s:label></td>
                <td><s:textfield id="empcode" name="empcode" value="%{#request['employees'].idnumber}"/></td>
                <td>&nbsp;</td>
                <td><s:label>Employee Name</s:label></td>
                <td><s:textfield id="empname" name="empname" value="%{#request['employees'].completename}"/></td>
            </tr>
            <tr>
                <td><s:label>Bank Code</s:label></td>
                <td><s:textfield id="bankcode" name="bankcode" value="%{#request.cashcustodian.bankcode}"/></td>
                <td>&nbsp;</td>
                <td><s:label>Bank Account No.</s:label></td>
                <td><s:textfield id="acctnum" name="acctnum" value="%{#request.cashcustodian.bankaccountnum}"/></td>
            </tr>
            <tr>
                <td><s:label>Date</s:label></td>
                <td><sj:datepicker id="dateccr" name="date" value="%{#request.cashcustodian.ccrdate}"/></td>
            </tr>
        </table>
        <table id="second">
            <tr>
                <td>&nbsp;</td>
                <th><s:label>Beginning Balance</s:label></th>
                <th><s:label>Deposit in Transit</s:label></th>
                <th><s:label>Collections</s:label></th>
                <th><s:label>Disbursement</s:label></th>
                <th><s:label>Additional Funds</s:label></th>
                <th><s:label>Bank Debit Memo</s:label></th>
                <th><s:label>Bank Credit Memo</s:label></th>
                <th><s:label>Ending Balance</s:label></th>
            </tr>
            <tr>
                <td><s:label>Cash in Bank</s:label></td>
                <s:if test="#session.branch.branchname=='Head Office'">
                    <td><s:textfield id="beginbalcib" name="beginbalcib" value="%{#request.cashcustodian.beginbalcib}"/></td>
                </s:if>
                <s:else>
                    <td><s:textfield id="beginbalcib" name="beginbalcib" value="0" cssStyle="display:none"/></td>
                </s:else>
                <td><s:textfield id="depintransitcib" name="depintransitcib" value="%{#request.cashcustodian.depositcib}"/></td>
                <td><s:textfield id="collectioncib" name="collectioncib" value="%{#request.cashcustodian.collcib}"/></td>
                <td><s:textfield id="disbursementcib" name="disbursementcib" value="%{#request.cashcustodian.disbursementcib}"/></td>
                <td><s:textfield id="addtlfundcib" name="addtlfundcib" value="%{#request.cashcustodian.addtlfundcib}"/></td>
                <td><s:textfield id="bankdebitmemocib" name="bankdebitmemocib" value="%{#request.cashcustodian.bankdebitcib}"/></td>
                <td><s:textfield id="bankcreditmemocib" name="bankcreditmemocib" value="%{#request.cashcustodian.bankcreditcib}"/></td>
                <s:if test="#session.branch.branchname=='Head Office'">
                    <td><s:textfield id="endbalcib" name="endbalcib" value="%{#request.cashcustodian.endbalcib}"/></td>
                </s:if>
                <s:else>
                    <td><s:textfield id="endbalcib" name="endbalcib" value="0" cssStyle="display:none"/></td>
                </s:else>
            </tr>
            <tr>
                <td><s:label>Cash on Hand</s:label></td>
                <td><s:textfield id="beginbalcoh" name="beginbalcoh" value="%{#request.cashcustodian.beginbalcoh}"/></td>
                <td><s:textfield id="depintransitcoh" name="depintransitcoh" value="%{#request.cashcustodian.depositcoh}"/></td>
                <td><s:textfield id="collectioncoh" name="collectioncoh" value="%{#request.cashcustodian.collcoh}"/></td>
                <td><s:textfield id="disbursementcoh" name="disbursementcoh" value="%{#request.cashcustodian.disbursementcoh}"/></td>
                <td><s:textfield id="addtlfundcoh" name="addtlfundcoh" value="%{#request.cashcustodian.addtlfundcoh}"/></td>
                <td><s:textfield id="bankdebitmemocoh" name="bankdebitmemocoh" value="%{#request.cashcustodian.bankdebitcoh}"/></td>
                <td><s:textfield id="bankcreditmemocoh" name="bankcreditmemocoh" value="%{#request.cashcustodian.bankcreditcoh}"/></td>
                <%--<td><s:textfield id="pettycashcoh" name="pettycashcoh"/></td>--%>
                <td><s:textfield id="endbalcoh" name="endbalcoh" value="%{#request.cashcustodian.endbalcoh}"/></td>
            </tr>
            <tr>
                <td><s:label>Total Cash</s:label></td>
                <td><s:textfield id="beginbaltotal" name="beginbaltotal" value="%{#request.cashcustodian.beginbalcoh}"/></td>
                <td><s:textfield id="depintransittotal" name="depintransittotal" value="%{#request.cashcustodian.deposittotalcash}"/></td>
                <td><s:textfield id="collectiontotal" name="collectiontotal" value="%{#request.cashcustodian.colltotalcash}"/></td>
                <td><s:textfield id="disbursementtotal" name="disbursementtotal" value="%{#request.cashcustodian.disbursementtotalcash}"/></td>
                <td><s:textfield id="addtlfundtotal" name="addtlfundtotal" value="%{#request.cashcustodian.addtfundtotalcash}"/></td>
                <td><s:textfield id="bankdebitmemototal" name="bankdebitmemototal" value="%{#request.cashcustodian.bankdebittotalcash}"/></td>
                <td><s:textfield id="bankcreditmemototal" name="bankcreditmemototal" value="%{#request.cashcustodian.bankcredittotalcash}"/></td>
                <td><s:textfield id="endbaltotal" name="endbaltotal" value="%{#request.cashcustodian.endbaltotalcash}"/></td>
            </tr>
        </table>
        <hr/>

        <sj:tabbedpanel id="tabpanel" value="tab">
            <sj:tab id="tab1" target="deposit" label="Deposit in Transit" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab2" target="collection" label="Collections" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab3" target="check" label="Check Disbursement" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab4" target="cash" label="Cash Disbursement" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab5" target="addtlfund" label="Additional Funds" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab6" target="bankdebit" label="Bank Debit Memo" cssStyle="font-size:12px;"></sj:tab>
            <sj:tab id="tab6" target="bankcredit" label="Bank Credit Memo" cssStyle="font-size:12px;"></sj:tab>
            <%--<sj:tab id="tab7" target="pettycash" label="Petty Cash Fund" cssStyle="font-size:12px;"></sj:tab>--%>

            <!--Deposit in Transit-->
            <s:div id="deposit" theme="simple" cssStyle="font-size:12px;">  
                <table>
                    <tr>
                        <td><s:label>Deposit Slip No.</s:label></td>
                        <td><s:textfield id="depositslipnum" name="depositslipnum" value="%{#request.cashcustodian.depositno}"/></td>

                        <td><s:label>Date Deposited</s:label></td>
                        <td><sj:datepicker id="datedeposit" name="datedeposit" value="%{#request.cashcustodian.depositdate}"/></td>

                        <td><s:label>Amount</s:label></td>
                        <td><s:textfield id="depositamount" name="depositamount" value="%{#request.cashcustodian.depositamount}"/></td>
                    </tr>
                </table>
                <br/>

                <table border="1px" cellspacing="0" style="width:500px">
                    <thead>
                        <tr>
                            <th>Area</th>
                            <th>Collector</th>
                            <th>Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.depositlist">
                            <tr>
                                <td><label><s:property value="areacode"/></label></td>
                                <td><label><s:property value="collector"/></label></td>
                                <td><label><s:property value="cashonhand"/></label></td>
                        <input name="depositid" style="display:none" value="<s:property value="collectionid"/>"/>


                        </tr>
                    </s:iterator>
                    </tbody>
                </table>
            </s:div>
            <!--Collections-->
            <s:div id="collection" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0" style="margin-left: -1em">
                    <thead>
                        <tr>
                            <th>Area Code</th>
                            <th>Collector Code</th>
                            <th>Collector</th>
                            <th>Document</th>
                            <th>Document No.</th>
                            <th>Document Date</th>
                            <th>Deposit Slip No.</th>
                            <th>Date Deposited</th>
                            <th>Cash in Bank</th>
                            <th>Cash on Hand</th>
                            <th>Total Collection</th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.collectionlist">

                            <tr>
                                <td><label><s:property value="areacode"/></label></td>
                                <td><label><s:property value="areas.employees.employeeid"/></label></td>
                                <td><label><s:property value="areas.collector"/></label></td>
                                <td><label><s:property value="documents.documenttype"/></label></td>
                                <td><label><s:property value="documents.documentno"/></label></td>
                                <td><label><s:property value="documents.documentdate"/></label></td>

                                <s:iterator value="depositses">
                                    <td><label><s:property value="depositno"/></label></td>
                                    <td><label><s:property value="depositdate"/></label></td>
                                    <td><label><s:property value="depositamount"/></label></td>
                                </s:iterator>
                                <td><label><s:property value="cashonhand"/></label></td>
                                <td><label><s:property value="totalamountcollected"/></label></td>
                                <%--<td><s:textfield style="width:50px;"/></td>
                                <td><s:textfield style="width:70px;"/></td>
                                <td><s:textfield style="width:70px;"/></td>
                                <td><s:textfield/></td>
                                <td><s:textfield style="width:90px;"/></td>
                                <td><s:textfield style="width:50px;"/></td>
                                <td><s:textfield style="width:90px;"/></td>
                                <td><s:textfield style="width:70px;"/></td>
                                <td><s:textfield style="width:90px;"/></td>
                                <td><s:textfield style="width:80px;"/></td>
                                <td><s:textfield style="width:80px;"/></td>
                                <td><s:textfield style="width:80px;"/></td>--%>
                        <input name="collectionid" style="display:none" value="<s:property value="collectionid"/>"/>

                        </tr>
                    </s:iterator>

                    </tbody>
                </table>
            </s:div>
            <!--Check Disbursement-->
            <s:div id="check" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th>Borrower</th>
                            <th>Check No.</th>
                            <th>Check Date</th>
                            <th>Amount</th>
                        </tr>
                    </thead>
                    <tbody >
                        <s:iterator value="#request.checklist">
                            <tr id="clonecheck" class="clonecheck">
                                <td><label name="checkseries"></label></td>
                                <td><label name="checkborrower"><s:property value="loans.borrowers.completename"/></label></td>
                                <td><label name="checknumber"><s:property value="checkno"/></label></td>
                                <td><label name="checkdate"><s:property value="checkdate"/></label></td>
                                <td><label name="checkamount"><s:property value="checkamount"/></label></td>
                        <input name="checkid" style="display:none"  value="<s:property value="checkid"/>"/>
                        </tr>
                    </s:iterator>
                    </tbody>
                </table>
            </s:div>  

            <!--Cash Disbursement-->
            <s:div id="cash" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th><label>Payee Firstname</label></th>
                            <th><label>Payee Middlename</label></th>
                            <th><label>Payee Lastname</label></th>
                            <th><label>Particulars</label></th>
                            <th><label>Document No.</label></th>
                            <th><label>Amount</label></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.cashlist">

                            <tr id="clonecash" class="clonecash">
                                <td><s:textfield cssStyle="width:50px;" id="cashseries" value="1"/></td>
                                <td><input id="cashpayeefname" name="cashpayeefname" value="<s:property value="payeeFirstname"/>" /></td>
                                <td><input id="cashpayeemname" name="cashpayeemname" value="<s:property value="payeeMiddlename"/>" /></td>
                                <td><input id="cashpayeelname" name="cashpayeelname" value="<s:property value="payeeLastname"/>" /></td>
                                <td><input id="cashparticular" name="cashparticular" value="<s:property value="particulars"/>"/></td>
                                <td><input id="cashdocnum" name="cashdocnum" value="<s:property value="docnum"/>"/></td>
                                <td><input id="cashfirst" name="cashamount" value="<s:property value="amount"/>" class="cashamount" /></td>
                                <td><input id="removebtncash" class="removebtn" value="Remove" type="button" style="width:60px"/></td>

                        <input name="cashid" style="display:none" value="<s:property value="cashid"/>"/>

                        </tr>
                    </s:iterator>

                    </tbody>
                </table>
            </s:div>

            <!--Additional Funds-->
            <s:div id="addtlfund" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th><label>Payee Firstname</label></th>
                            <th><label>Payee Middlename</label></th>
                            <th><label>Payee Lastname</label></th>
                            <th><label>Particulars</label></th>
                            <th><label>Document No.</label></th>
                            <th><label>Amount</label></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.addtlfundlist">
                            <tr id="clonefund" class="clonefund">
                                <td><s:textfield cssStyle="width:50px;" id="seriesfund" value="1"/></td>
                                <td><input id="payeefundfname" name="payeefundfname"  value="<s:property value="payeeFirstname"/>" /></td>
                                <td><input id="payeefundmname" name="payeefundmname"  value="<s:property value="payeeMiddlename"/>" /></td>
                                <td><input id="payeefundlname" name="payeefundlname"  value="<s:property value="payeeLastname"/>" /></td>
                                <td><input id="particularfund" name="particularfund"  value="<s:property value="particulars"/>" /></td>
                                <td><input id="docnumfund" name="docnumfund"  value="<s:property value="docnum"/>"/></td>
                                <td><input id="firstfund" name="amountfund"  value="<s:property value="amount"/>" class="amountfund"/></td>
                                <td><input id="removebtnfund" class="removebtn" value="Remove" type="button" style="width:60px"/></td>

                        <input name="fundid" style="display:none" value="<s:property value="fundid"/>"/>
                        </tr>
                    </s:iterator>
                    </tbody>
                </table>
            </s:div>

            <!--Bank Debit Memo-->
            <s:div id="bankdebit" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th>Particulars</th>
                            <th>Amount</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.bankdebitlist">

                            <tr id="clonedebit" class="clonedebit">
                                <td><s:textfield cssStyle="width:50px;" id="seriesdebit" value="1"/></td>
                                <td><input id="particulardebit" name="particulardebit"  value="<s:property value="particulars"/>" /></td>
                                <td><input id="firstdebit" name="amountdebit" class="amountdebit"  value="<s:property value="amount"/>"/></td>
                                <td><input id="removebtndebit" class="removebtn" value="Remove" type="button" style="width:60px"/></td>

                        <input name="bankdebitmemoid" style="display:none" value="<s:property value="bankdebitmemoid"/>"/>
                        </tr>
                    </s:iterator>

                    </tbody>
                </table>
            </s:div>

            <!--Bank Credit Memo-->
            <s:div id="bankcredit" theme="simple" cssStyle="font-size:12px;">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th>Particulars</th>
                            <th>Amount</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.bankcreditlist">

                            <tr id="clonecredit" class="clonecredit">
                                <td><s:textfield cssStyle="width:50px;" id="seriescredit" value="1"/></td>
                                <td><input id="particularcredit" name="particularcredit" value="<s:property value="particulars"/>" /></td>
                                <td><input id="firstcredit" name="amountcredit" value="<s:property value="amount"/>" class="amountcredit"/></td>
                                <td><input id="removebtncredit" class="removebtn" value="Remove" type="button" style="width:60px"/></td>

                            </tr>
                        <input name="bankcreditmemoid" style="display:none" value="<s:property value="bankcreditmemoid"/>"/>

                    </s:iterator>
                    </tbody>

                </table>
            </s:div>
        </sj:tabbedpanel>
    </s:form>


    <s:div cssStyle="clear:left;float:right">
        <sj:a id="viewccr" button="true" cssStyle="font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;" >View</sj:a>
        <sj:submit id="savereport" value="Post"  button="true" cssClass="ui-state-default" cssStyle="font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;" />
    </s:div>
</div>